
#!/bin/bash
SCRIPT_DIR=$(cd "$(dirname "$0")" && pwd)
SFTP_TOOL="$SCRIPT_DIR/../tools/sftp"

# Get the file name at remote path
REMOTE_PATH=/hygon-devkit/4.0/2025-01-01/hceph
FILE_NAME=ceph_test_msgr


if [ ! -f "$SFTP_TOOL" ]; then
    if [ ! -f ./sftp ]; then
        wget https://gitee.com/anolis/hygon-devkit/raw/master/tools/sftp
    fi
    chmod +x sftp
    ./sftp download "$REMOTE_PATH"/$FILE_NAME $SCRIPT_DIR/$FILE_NAME
else
    "$SFTP_TOOL" download "$REMOTE_PATH"/$FILE_NAME $SCRIPT_DIR/$FILE_NAME
fi
if [ $? -ne 0 ]; then
    echo "Download failed"
    exit 1
fi


sudo yum install leveldb leveldb-devel gperftools-libs -y
sudo chmod +x $FILE_NAME

LD_PRELOAD=/opt/hygon/hceph/libhceph-common.so.0 ./ceph_test_msgr